[GENERAL] Two variable passed to PL/Function and on is NULL - Mailing list pgsql-general

From Stuart Rison
Subject [GENERAL] Two variable passed to PL/Function and on is NULL
Date
Msg-id v04020a05b38aa7ad8bc7@[128.40.242.190]
Whole thread Raw
Responses Re: [GENERAL] Two variable passed to PL/Function and on is NULL  (Herouth Maoz <herouth@oumail.openu.ac.il>)
List pgsql-general
Dear All,

I have written a PL/pgSQL fucntion which takes two arguments and returns a
boolean on the basis of a few (string) comparaisons.

The function works fine as long as BOTH passed variables are non-NULL but
behaves strangely if one of the variables is non-NULL.

Looking at previous postings, I found:

>Very observant of you.  The postgres function system doesn't have a way
>to tell which parameter is null, so the function just returns null.
>I don't like it and we hope to get it changed for PGv6.5 (at least I
>do).

Now that example was with a 'c' function but presumably, function are
handled the same way internally whatever the function language?

SO my question are:

i) Is it the case that if you pass to variables to a postgres function and
one is NULL, the function cannot tell which one?
ii) Is there a workaround of some kind (in particular in pl/pgsql)?
[Currently I am copying the table into a temp table and updating all NULL
values to a token value.]

regards,

Stuart.


+-------------------------+--------------------------------------+
| Stuart Rison            | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street               |
| Tel. (0171) 878 4041    | London, W1P 8BT, UNITED KINGDOM.     |
| Fax. (0171) 878 4040    | stuart@ludwig.ucl.ac.uk              |
+-------------------------+--------------------------------------+

pgsql-general by date:

Previous
From: Sascha Schumann
Date:
Subject: Re: [GENERAL] Re: [HACKERS] postgres processes
Next
From: Herouth Maoz
Date:
Subject: Re: [GENERAL] Two variable passed to PL/Function and on is NULL